﻿using System;

namespace ServerUtils
{
    public class FuncOperation<TResult> : IOperation<TResult>
    {
        private Func<TResult> func;

        public FuncOperation(string name, object request, Func<TResult> func)
        {
            this.Name = name;
            this.Request = request;
            this.func = func;
        }

        public long OperationId { get; set; }

        public string Name { get; private set; }

        public object Request{ get; private set; }

        public TResult Execute()
        {
            return this.func();
        }
    }
}
